﻿﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/teleweb/common/global.jsp" %>
<%@page import="com.cndatacom.teleweb.fileupload.been.FileUpload"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中国通信服务</title>

<link href="teleweb/css/ztf.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/roll.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/content.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/upload-component.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="teleweb/js/upload.js"></script>
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>

</head>

<body onload="initAttach('${wn.photo}','')">
<script>
function initAttachs(){
   <c:if test="${!empty photos}">
		<c:forEach items="${photos}" var="po" varStatus="status" step="1" begin="0">
		    initAttach('${po}','[插图${status.index}]');       
		</c:forEach>
   </c:if>
}
function validateSubmitForm(form){
	var value = form.content.value;
    var size = value.replace(/[\u4e00-\u9fa5]/g," ").length;
    if(size>=2000) {
		alert("工作动态内容不能超过2000个汉字!");
		return false;
    }
	value = form.title.value;
	if(value.length<=0){
		alert("标题不能为空!");
		return false;
	}
	value = form.publishDate.value;
	if(value.length<=0){
		alert("发布日期不能为空!");
		return false;
	}
	value = form.content.value;
	if(value.length<=0){
		alert("正文不能为空!");
		return false;
	}
	document.getElementById("random").value = document.getElementById("randomfolder").value;
	if(document.getElementById("uploads").innerHTML == null || document.getElementById("uploads").innerHTML == "") {
		//alert("附件不能为空！");
		//return false;
	}
return true;
}
</script>

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <!-- 主体table -->
  <%request.setAttribute("panel","WN");%>
  <%@ include file="/teleweb/common/include/header.jsp" %>
  
  <tr>
    <!---首页内容--->
    <td class="new_indexcontent">
    <div class="new_stars">
    <div class="new_weizhi">你现在所在的位置：<a href="${ctx}/index">首页</a>><a href="${ctx}/listWorkNews.action">工作动态</a></div>
    </div>
    <!---圆角--->
    <div class="box-cir3">
			<div class="t_l"></div>
			<div class="t_m"></div>
			<div class="t_r"></div>
			<div class="m_l"></div>
			<div class="m_m1">
    <!---标题内容--->
			<div class="new_heading1">
            <h3>工作动态</h3>
            </div>
            <div class="new_textform">
                <center><font color="red"><s:actionmessage/><s:actionerror/></font></center>
                
			<form action="worknews-save.action" method="post" enctype ="multipart/form-data" id="saveWorkNewsForm" onsubmit="return validateSubmitForm(this);">
            	<input type="hidden" name="id" value="${wn.id}">
            	<input type="hidden" name="photo" value="${wn.photo}">
            	<input type="hidden" name="clickCount" value="${wn.clickCount}">
            	<input type="hidden" name="random" id="random" value="${random}">
            	<input type="hidden" name="attachnum" value="${attachNum}">
            	<input type="hidden" name="allowType" id="allowtype" value="jpg;png;gif;bmp">
			
            <table cellpadding="0" cellspacing="0">
	            <tr>
	            <td class="new_textlable"><span class="new_lable">标题</span><span class="new_redstar">*</span>
	            </td>
	            <td>
	                <input type="text" class="new_text" name="title" value="${wn.title}"/>
	            </td>
	            </tr>
	            <tr>
	            <td class="new_textlable"><span class="new_lable">发布日期</span><span class="new_redstar">*</span>
	            </td>
	            <td>
	            	<input class="Wdate" type="text" name="publishDate" value="${fn:substring(wn.publishDate, 0, 16)}" id="pubdate" style="padding-left:4px;width:150" onClick="WdatePicker({skin:'YcloudRed',dateFmt:'yyyy-MM-dd HH:mm'})">
	            </td>
	            </tr>
	            <tr>
	            <td class="new_textlable"><span class="new_lable">副标题</span>
	            </td>
	            <td><input type="text" class="new_text" name="subTitle" value="${wn.subTitle}"/>
	            </td>
	            </tr>
	            <tr>
	            <td class="new_textlable"><span class="new_lable">来源</span>
	            </td>
	            <td><input type="text" class="new_text" name="source" value="${wn.source}"/>
	            </td>
	            </tr>
	            <tr>
	            <td class="new_textlable"><span class="new_lable">作者</span>
	            </td>
	            <td><input type="text" class="new_text" name="author" value="${wn.author}"/>
	            </td>
	            </tr>
	            <tr>
	            <td class="new_textlable new_textarea" valign="top"><span class="new_lable">正文</span><span class="new_redstar">*</span>
	            </td>
	            <td>
	            	<textarea id="content" name ="content" class="new_text" style="heigth:200px">${wn.content}</textarea> 
	            </td>
	            </tr>
            </table>
            </form>
            
            <div style="color:red"><s:fielderror><s:param>attach</s:param></s:fielderror></div>
            <upload:load></upload:load>
            
			<table>
            	<tr>
            		<td class="new_textlable"></td>
            		<td align="center">
					    <div class="new_btform">
					    	<script> 
						    	function submitSave(form){
						    	    if(!validateSubmitForm(form))return false;
						    	    if(!confirm("确定保存吗?")) return false;
						    	    form.submit();
						    		return true;
						    	}
					    	</script>
						    <button id="saveBnt" class="new_btforml" onclick="return submitSave(document.getElementById('saveWorkNewsForm'));">保存</button>
						    <button id="resetBnt" onclick="document.getElementById('saveWorkNewsForm').reset();">重置</button>
					    </div>
            		</td>
            	</tr>
            </table>
            
            </center>
            
            </div>                              
			</div>
			<div class="m_r"></div>
			<div class="b_l"></div>
			<div class="b_m"></div>
			<div class="b_r"></div>
		</div>
    </td>
  </tr>
  <%@ include file="common/include/tail.jsp"%>
</table>

</body>
</html>

<script>
	CKEDITOR.replace('content');   //content为textarea的id
</script>
